import 'package:architecture/os_size.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:study_demo/ui/ai/ai_page.dart';
import 'package:study_demo/ui/api_query/api_query_page.dart';
import 'package:study_demo/ui/board_activate_state/board_activate_state_page.dart';
import 'package:study_demo/ui/go_terms/go_terms_page.dart';
import 'package:study_demo/ui/medicine/medicine_page.dart';
import 'package:study_demo/ui/network/network_page.dart';
import 'package:study_demo/ui/query_board_code/query_board_code_page.dart';
import 'package:study_demo/ui/role_admin/role_admin_page.dart';
import 'package:study_demo/ui/tool/adb/adb_page.dart';
import 'package:study_demo/ui/tool/api_tool/api_tool_page.dart';
import 'package:study_demo/ui/tool/board_command/board_command_page.dart';
import 'package:study_demo/ui/tool/custom_widget/custom_widget_hall_page.dart';
import 'package:study_demo/ui/tool/ip_query/ip_query_page.dart';
import 'package:study_demo/ui/tool/phone_num_query/phone_num_query_page.dart';
import 'package:study_demo/ui/tool/picture_conduct/picture_conduct_detail_page.dart';
import 'package:study_demo/ui/tool/print_pdf/print_pdf_page.dart';
import 'package:study_demo/ui/tool/re_sign/re_sign_page.dart';
import 'package:study_demo/ui/tool/read_excel/read_excel_page.dart';
import 'package:study_demo/ui/tool/scatter_diagram/scatter_diagram_page.dart';
import 'package:study_demo/ui/tool/show_html/show_html_page.dart';
import 'package:study_demo/ui/tool/tool_controller.dart';
import 'package:study_demo/ui/tool/upload_music/upload_music_page.dart';
import 'package:study_demo/ui/tool/work_note/work_note_page.dart';

import '../../widgets/text_button.dart';
import '../main/pages/calculator_page.dart';
import '../test_word_speed/test_word_speed_page.dart';
import '../transform_lower_to_upper/transform_lower_to_upper_page.dart';
import 'distribute_board/distribute_board_page.dart';
import 'md5_helper/md5_helper_page.dart';

class ToolPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GetBuilder(
        init: ToolController(),
        builder: (controller) {
          return Container(
              margin: EdgeInsets.only(top: 20),
              height: windowHeight,
              child: Column(
                children: [
                  Wrap(
                      alignment: WrapAlignment.start,
                      crossAxisAlignment: WrapCrossAlignment.start,
                      spacing: 20,
                      runSpacing: 20,
                      children: [
                        MyTextButton(
                          text: "网络状态监听",
                          confirm: () {
                            Get.to(NetworkPage());
                          },
                        ),
                        MyTextButton(
                          text: "计算器",
                          confirm: () {
                            Get.to(CalculatorPage());
                          },
                        ),
                        MyTextButton(
                          text: "打字测速",
                          confirm: () {
                            Get.to(TestWordSpeedPage());
                          },
                        ),
                        MyTextButton(
                          text: "生成二维码",
                          confirm: () {
                            controller.generateCode();
                          },
                        ),
                        MyTextButton(
                          text: "pdf转图片",
                          confirm: () {
                            controller.pdfToPng();
                          },
                        ),
                        MyTextButton(
                          text: "png转webp",
                          confirm: () {
                            controller.pngToWebP();
                          },
                        ),
                        MyTextButton(
                          text: "文字转语音",
                          confirm: () {
                            controller.goWordToAudio();
                          },
                        ),
                        MyTextButton(
                          text: "json校验",
                          confirm: () {
                            controller.jsonCheck();
                          },
                        ),
                        MyTextButton(
                          text: "json转实体",
                          confirm: () {
                            controller.goJsonToModelPage();
                          },
                        ),
                        MyTextButton(
                          text: "getx模板生成",
                          confirm: () {
                            controller.goGetXTemplateGeneratePage();
                          },
                        ),
                        _toolTip('支持仅含字母的字符串,小写转大写和大写转小写',
                            child: MyTextButton(
                              text: "大小写转换",
                              confirm: () {
                                Get.to(TransformLowerToUpperPage());
                              },
                            )),
                        _toolTip('查询棋盘的激活状态、国家信息、并支持修改国籍',
                            child: MyTextButton(
                              text: "棋盘激活状态",
                              confirm: () {
                                Get.to(BoardActivateStatePage());
                              },
                            )),
                        // _toolTip('查询棋盘的编号',
                        //     child: MyTextButton(
                        //       text: "查询棋盘编号",
                        //       confirm: () {
                        //         Get.to(QueryBoardCodePage());
                        //       },
                        //     )),
                        _toolTip('查询隐智围棋的后台接口方法',
                            child: MyTextButton(
                              text: "接口查询",
                              confirm: () {
                                Get.to(ApiQueryPage());
                              },
                            )),
                        // MyTextButton(
                        //   text: "角色管理",
                        //   confirm: () {
                        //     Get.to(RoleAdminPage());
                        //   },
                        // ),
                        MyTextButton(
                            text: "小儿常用药",
                            confirm: () {
                              Get.to(MedicinePage());
                            }),
                        MyTextButton(
                          text: "ip地址查询",
                          confirm: () {
                            Get.to(IpQueryPage());
                          },
                        ),
                        MyTextButton(
                          text: "手机号码归属地查询",
                          confirm: () {
                            Get.to(PhoneNumQueryPage());
                          },
                        ),
                        _toolTip('支持查看文件的md5、SHA-1、SHA-256',
                            child: MyTextButton(
                              text: "MD5",
                              confirm: () {
                                Get.to(Md5HelperPage());
                              },
                            )),
                        MyTextButton(
                          text: "棋盘指令",
                          confirm: () {
                            Get.to(BoardCommandPage());
                          },
                        ),
                        // MyTextButton(
                        //   text: "重新签名",
                        //   confirm: () {
                        //     Get.to(ReSignPage());
                        //   },
                        // ),
                        _toolTip('支持图片批量重命名、格式转换和大小修改',
                            child: MyTextButton(
                              text: "图片处理",
                              confirm: () {
                                Get.to(PictureConductDetailPage());
                                // Get.to(RenamePagePlus());
                              },
                            )),
                        // !isWeb()?
                        //     _toolTip('支持常用的adb命令',
                        //        child: MyTextButton(
                        //          text: "adb功能",
                        //          confirm: () {
                        //            Get.to(AdbPage());
                        //          },
                        //        )):Container(),
                        MyTextButton(
                          text: "api工具",
                          confirm: () {
                            Get.to(ApiToolPage());
                          },
                        ),
                        // !isWeb()?
                        //    MyTextButton(
                        //        text: "工作日志",
                        //        confirm: () {
                        //          Get.to(WorkNotePage());
                        //        },
                        //      ):Container(),
                        MyTextButton(
                          text: "AI相关",
                          confirm: () {
                            Get.to(AIPage());
                          },
                        ),
                        MyTextButton(
                          text: "读取excel",
                          confirm: () {
                            Get.to(ReadExcelPage());
                          },
                        ),
                        MyTextButton(
                          text: "打印pdf",
                          confirm: () {
                            Get.to(PrintPdfPage());
                          },
                        ),
                        MyTextButton(
                          text: "显示html",
                          confirm: () {
                            Get.to(ShowHtmlPage());
                          },
                        ),
                        MyTextButton(
                          text: "上传音乐",
                          confirm: () {
                            Get.to(UploadMusicPage());
                          },
                        ),
                        MyTextButton(
                          text: "分配棋盘",
                          confirm: () {
                            Get.to(DistributeBoardPage());
                          },
                        ),
                        MyTextButton(
                          text: "围棋术语",
                          confirm: () {
                            Get.to(GoTermsPage());
                          },
                        ),
                      ]),
                  // SizedBox(
                  //   height: 20,
                  // ),
                  // Row(
                  //   spacing: 30,
                  //   children: [
                  //     MyTextButton(
                  //       text: "测试1",
                  //       confirm: () {
                  //         Get.to(NetworkPage());
                  //       },
                  //     ),
                  //     MyTextButton(
                  //       text: "测试2",
                  //       confirm: () {
                  //         Get.to(CalculatorPage());
                  //       },
                  //     ),
                  //     MyTextButton(
                  //       text: "测试3",
                  //       confirm: () {
                  //         Get.to(TestWordSpeedPage());
                  //       },
                  //     ),
                  //   ],
                  // ),
                  // Column(
                  //   spacing: 20,
                  //   children: [
                  //     MyTextButton(
                  //       text: "测试1",
                  //       confirm: () {
                  //         Get.to(NetworkPage());
                  //       },
                  //     ),
                  //     MyTextButton(
                  //       text: "测试2",
                  //       confirm: () {
                  //         Get.to(CalculatorPage());
                  //       },
                  //     ),
                  //     MyTextButton(
                  //       text: "测试3",
                  //       confirm: () {
                  //         Get.to(TestWordSpeedPage());
                  //       },
                  //     ),
                  //   ],
                  // )
                ],
              ));
        });
  }

  _toolTip(String msg, {Widget? child}) {
    return Tooltip(
      message: msg,
      height: 35,
      child: child,
    );
  }
}
